package com.example.other.mapper;

import com.example.other.domain.Hospital;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.other.domain.VO.RankVO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author Limhuang
* @description 针对表【hospital】的数据库操作Mapper
* @createDate 2024-07-03 10:15:00
* @Entity com.example.other.domain.Hospital
*/
public interface HospitalMapper extends BaseMapper<Hospital> {
    @Select("SELECT hospital.`name`,COUNT(hospital.`name`) total FROM orders LEFT JOIN hospital on orders.hpId=hospital.hp_Id WHERE orders.state=1 GROUP BY hospital.`name`" +
            "ORDER BY total DESC")
    List<RankVO> getHospitalRank();
}




